/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ventasInternet.entityDAO;

import com.ventasInternet.entity.Imagen;
import com.ventasInternet.entity.Producto;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author DESARO03
 */
@Stateless
public class ImagenFacade extends AbstractFacade<Imagen> implements ImagenFacadeLocal {
    @PersistenceContext(unitName = "VentasInternet-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ImagenFacade() {
        super(Imagen.class);
    }
    public List<Imagen> listaImagesProducto(Producto pro){
         List<Imagen> listaImagenTmp;
        Query q = null;
        q = em.createNamedQuery("Imagen.findByProducto");
        q.setParameter("producto", pro);
        listaImagenTmp = q.getResultList();
        return listaImagenTmp;  
        
       
    }
}
